package cn.wit.luohui.day04;
import java.util.Arrays;

public class ArrayMerge {
	 public static void main(String[] args) {
		 int[] a1 = {1, 5, 16}, a2 = {3, 4, 6, 7};
		 merge(a1, a2);
		 
	 }
	 public static int[] merge(int[] a1, int[] a2) {
		 
	 int[] array=new int[a1.length+a2.length];
	 
	 for(int i = 0;i<a1.length-1;i++) {
	 array[i]=a1[i];}
	 
	 for(int j =0;j<a2.length-1;j++) {
		 array[a1.length+j]=a2[j];
	 }
	 
	 
//	 for(int n = 0;n<array.length-1;n++) {
//		 for (int m=0;m<n;m++) {
//				if(array[m]>array[m+1]) {
//					int temp = array[m]; 
//
//					array[m] = array[m+1]; 
//
//					array[m+1] = temp;
//				}	 
// }
	 Arrays.sort(array);
		 System.out.println(Arrays.toString(array));
          return array;
	 }
}
